#ifndef __YLW_THREAD_H__
#define __YLW_THREAD_H__

#include "Noncpoyable.hpp"

#include <pthread.h>
#include <functional>

namespace ylw
{

class Thread : Noncopyable
{

using ThreadCallback = std::function<void()>;

public:
    Thread(ThreadCallback && cb);

    void start();
    void join();

    virtual ~Thread();

private:
    static void* threadFunc(void*);
private:
    pthread_t _pthid;
    bool _isRunning;
    ThreadCallback _cb;
};

}//end of namespace ylw

#endif
